<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<style>

    .layui-table th, .layui-table td{
        padding: 9px 6px;
        text-align: center;
    }
    .operation-menu a{
        margin: 5px 0;!important;
    }
    /*.layui-form select{*/
    /*display: inline-block;*/
    /*}*/
</style>
<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form class="layui-form serch" action="{:url('admin/Articlecomment/index')}" method="post">
                <div class="layui-form-item" style="float: left;">


                    <div class="layui-input-inline">
                        <input type="text" name="comment_id" value="{if isset($wherelist['comment_id'])}{$wherelist['comment_id']}{/if}" lay-verify="title" autocomplete="off" placeholder="评论编号" class="layui-input layui-btn-sm">
                    </div>
                    <!--<div class="layui-input-inline">-->
                    <!--<div class="layui-inline">-->

                    <!--&lt;!&ndash;<input type="text" name="goods_mane" lay-verify="title" autocomplete="off" placeholder="商品名称" class="layui-input layui-btn-sm">&ndash;&gt;-->
                    <!--&lt;!&ndash;&lt;!&ndash;<select name="coupon_types" lay-search="">&ndash;&gt;&ndash;&gt;-->
                    <!--&lt;!&ndash;<option value="">优惠券类型</option>&ndash;&gt;-->
                    <!--&lt;!&ndash;<option value="1">折扣</option>&ndash;&gt;-->
                    <!--&lt;!&ndash;<option value="2">满减</option>&ndash;&gt;-->
                    <!--&lt;!&ndash;</select>&ndash;&gt;-->
                    <!--</div>-->
                    <!--</div>-->

                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <select name="comment_status" lay-search="">
                                <option value="">商品状态</option>
                                <option value="1" {if isset($wherelist['comment_status']) AND $wherelist['comment_status']==1 }selected{/if}>未审核</option>
                                <option value="2" {if isset($wherelist['comment_status']) AND $wherelist['comment_status']==2 }selected{/if}>已审核</option>
                            </select>
                        </div>
                    </div>


                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <!--<a href="{//:url('admin/goods/addgoods')}" class="layui-btn layui-btn-sm a_menu">-->
                    <!--新增商品-->
                    <!--</a>-->

                </div>
            </form>

        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line">
        <colgroup>
            <col width="10%">
            <col width="10%">
            <col width="10%">
            <!--<col width="8%">-->
            <col width="10%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
            <col width="12%">
        </colgroup>
        <thead>

        <tr>
            <th>评论编号</th>
            <th>会员昵称</th>
            <th>文章名称</th>
            <th>评论内容</th>
            <!--<th>评论积分</th>-->
            <th>审核状态</th>
            <th>发布时间</th>
            <th>更新时间</th>
            <th>审核人员</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name='lie' id='v'}
        <tr>
            <td>{$v.comment_id}</td>
            <td style="text-align: center">
                {$v.member.member_nickname}
            <td class="">
                {$v.article.title}
            </td>
            <!--width: 100px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;-->
            <td title="{$v.content}">
                <div  style="width: 200px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
                    {$v.content}
                </div>

            </td>

            <td>
                {switch name="v.comment_status"}
                {case value="1"}待审核 {/case}
                {case value="2"}审核通过 {/case}
                {default /}default
                {/switch}
            </td>
            <td>{$v.creattime|date='Y-m-d H:i:s',###} </td>
            <td>{notempty name='$v.updatetime'}{$v.updatetime|date='Y-m-d H:i:s',###}{/notempty}</td>

            <td>
                {notempty name='$v.admin_id'}{$v.admin.nickname}{/notempty}
            </td>
            <td class="operation-menu">

                <a href="####" codeid="{$v.comment_id}" class="layui-btn layui-btn-xs layui-btn-warm delete"  style="margin-right: 0;font-size:12px;background: red">删除</a>
                {switch name="v.comment_status"}
                {case value="1"} <a href="####" class="layui-btn layui-btn-xs layui-btn-danger shelves" data-id="{$v.comment_status}"  codeid="{$v.comment_id}" style="margin-right: 0;font-size:12px;">审核</a>{/case}
                {case value="2"} <a href="####" class="layui-btn layui-btn-xs layui-btn-danger " data-id="{$v.comment_status}" codeid="{$v.comment_id}" style="margin-right: 0;font-size:12px;background: #777777">已审核</a>{/case}
                {default /}default
                {/switch}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$lie->render()}</div>

    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>

    <script>
        var message;
        layui.config({
            base: '__JS__/',
            version: '1.0.1'
        }).use(['app', 'message'], function() {
            var app = layui.app,
                $ = layui.jquery,
                layer = layui.layer;
            //将message设置为全局以便子页面调用
            message = layui.message;
            //主入口
            app.set({
                type: 'iframe'
            }).init();
        });
    </script>
    <script type="text/javascript">

        $('.delete').click(function(){
            var id = $(this).attr('codeid');

            layer.confirm('确定要删除?', function(index) {
                $.ajax({
                    url:"{:url('admin/Articlecomment/del')}",
                    data:{id:id},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })
        $('.shelves').click(function(){
            var id = $(this).attr('codeid');
            var comment_status= $(this).attr('data-id');
            layer.confirm('是否确定操作？', function(index) {
                $.ajax({
                    url:"{:url('admin/Articlecomment/review')}",
                    data:{id:id,comment_status:comment_status},
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })



        // $('.copy').click(function(){
        //     var id = $(this).attr('codeid');
        //     layer.confirm('确定复制吗?', function(index) {
        //         $.ajax({
        //             url:"{:url('admin/trip/copytrip')}",
        //             data:{id:id},
        //             success:function(res) {
        //                 layer.msg(res.msg);
        //                 if(res.code == 1) {
        //                     setTimeout(function(){
        //                         location.reload();
        //                     },1500)
        //                 }
        //             }
        //         })
        //     })
        // })

    </script>
    <script type="text/javascript">
        layui.use('layer', function(){
            var layer = layui.layer;
            $('.a_menu').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                })
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['700px', '680px'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            })

            $('.preview').click(function(){
                var url = $(this).attr('href');
                layer.open({
                    type:2,
                    content:url,
                    area: ['550px', '400px']
                });
                return false;
            })
        });
    </script>

</body>
</html>
